#define _CRT_SECURE_NO_WARNINGS
#include<iostream>



//int main()
//{
//	using namespace std;
//	int yams[3];
//	yams[0] = 7;
//	yams[1] = 8;
//	yams[2] = 6;
//
//	int yamcosts[3] = { 20,30,5 };
//	cout << "Total yams = ";
//	cout << yams[0] + yams[1] + yams[2] << endl;
//	cout << "The package with " << yams[1] << " yams costs ";
//	cout << yamcosts[1] << " cents per yams.\n";
//	int total = yams[0] * yamcosts[0] + yams[1] * yamcosts[1] + yams[2] * yamcosts[2];
//	cout << "The total yams expense is " << total << " cents.\n";
//
//	cout << "\nSize of yams array = " << sizeof yams << " bytes.\n";
//	cout << "Size of one element = " << sizeof yams[0] << " bytes.\n";
//
//	return 0;
//}



//#include<cstring>
//
//int main()
//{
//	using namespace std;
//	const int Size = 15;
//	char name1[Size];
//	char name2[Size]{ "c++owboy" };
//	cout << "Howdy! I'm " << name2 << "! What's your name ?\n";
//	cin >> name1;
//	cout << "Well, " << name1 << ", Your name has ";
//	cout << strlen(name1) << " letters and is stored\n";
//	cout << "in an array of " << sizeof(name1) << " bytes.\n";
//	cout << "Your initial is " << name1[0] << ".\n";
//	name2[3] = '\0';
//	cout << "Here are the first 3 characters of my name:";
//	cout << name2 << endl;
//
//	return 0;
//}



//instr1.cpp
//#include<iostream>
//
//int main()
//{
//	using namespace std;
//	const int ArSize = 20;
//	char name[ArSize];
//	char dessert[ArSize];
//
//	cout << "Enter your name:";
//	cin >> name;
//	cout << "Enter your favorite dessert:";
//	cin >> dessert;
//	cout << "I have some delicious " << dessert << " for you," << name << ".\n";
//
//	return 0;
//}



//instr2.cpp
//#include<iostream>
//
//int main()
//{
//	using namespace std;
//	const int ArSize = 20;
//	char name[ArSize];
//	char dessert[ArSize];
//
//	cout << "Enter your name:";
//	cin.getline(name,ArSize);
//	cout << "Enter your favorite dessert:";
//	cin.getline(dessert,ArSize);
//	cout << "I have some delicious " << dessert << " for you," << name << ".\n";
//
//	return 0;
//}



//#include<iostream>
//
//int main()
//{
//	using namespace std;
//	const int ArSize = 20;
//	char name[ArSize];
//	char dessert[ArSize];
//
//	cout << "Enter your name:";
//	cin.get(name, ArSize).get();
//	cout << "Enter your favorite dessert:";
//	cin.get(dessert, ArSize).get();
//	cout << "I have some delicious " << dessert << " for you," << name << ".\n";
//
//	return 0;
//}



//numstr.cpp
//#include<iostream>
//
//int main()
//{
//	using namespace std;
//	cout << "What year was your house buit?\n";
//	int year;
//	cin >> year;
//	cout << "What is its street address?\n";
//	char address[80];
//	cin.getline(address,80);
//	cout << "Your buit: " << year << endl;
//	cout << "Address: " << address << endl;
//	cout << "Done!\n";
//
//	return 0;
//}



//strtype1.cpp
//#include<string>
//
//int main()
//{
//	using namespace std;
//	char charr1[20];
//	char charr2[20]{ "jaguar" };
//	string str1;
//	string str2{ "panther" };
//
//	cout << "Enter a kind of feline: ";
//	cin >> charr1;
//	cout << "Enter another kind of feline: ";
//	cin >> str1;
//	cout << "Here are some felines:\n";
//	cout << charr1 << " " << charr2 << " " << str1 << " " << str2 << " " << endl;
//	
//	cout << "The third letter in " << charr2 << " is " << charr2[2] << endl;
//	cout << "The third letter in " << str2 << " is " << str2[2] << endl;
//
//	return 0;
//}



//strtype.cpp
//#include<string>
//
//int main()
//{
//	using namespace std;
//	string s1{ "penguin" };
//	string s2, s3;
//
//	cout << "You can assign one string object to another: s2 = s1\n";
//	s2 = s1;
//	cout << "s1 : " << s1 << ", s2 : " << s2 << endl;
//	cout << "You can assign a C_style string to a string object.\n";
//	cout << "s2 = \"buzzard\"\n";
//	s2 = "buzzard";
//	cout << "s2: " << s2 << endl;
//	cout << "You can concatenate strings: s3 = s1 + s2\n";
//	s3 = s1 + s2;
//	cout << "s3 : " << s3 << endl;
//	cout << "You can append strings.\n";
//	s1 += s2;
//	cout << "s1 += s2 yields s1 : " << s1 << endl;
//	s2 += " for a day";
//	cout << "s2 += \" for a day\" yields s2 : " << s2 << endl;
//
//	return 0;
//}



//strtype3.cpp
//#include<string>
//#include<cstring>
//
//int main()
//{
//	using namespace std;
//	char charr1[20];
//	char charr2[20] = "jaguar";
//	string str1;
//	string str2 = "panther";
//
//	strcpy(charr1, charr2);
//	str1 = str2;
//
//	strcat(charr1, " juice");
//	str1 += " paste";
//
//	int len1 = strlen(charr1);
//	int len2 = str1.size();
//
//	cout << "The string " << charr1 << " contains " << len1 << " characters.\n";
//	cout << "The string " << str1 << " contains " << len2 << " characeters.\n";
//
//	return 0;
//}



//strtype4.cpp
//#include<string>
//#include<cstring>
//
//int main()
//{
//	using namespace std;
//	char charr[20];
//	string str;
//
//	cout << "Length of string in charr before input: ";
//	cout << strlen(charr) << endl;
//	cout << "Length of string in str before input: ";
//	cout << str.size() << endl;
//	cout << "Enter a line of text:\n";
//	cin.getline(charr, 20);
//	cout << "You entered: " << charr << endl;
//	cout << "Enter another line of text:\n";
//	getline(cin, str);
//	cout << "You entered: " << str << endl;
//	cout << "Length of string in charr after input: ";
//	cout << strlen(charr) << endl;
//	cout << "Length of string in str after input: ";
//	cout << str.size() << endl;
//
//	return 0;
//}


//structur.cpp
//struct inflateable
//{
//	char name[20];
//	float volumn;
//	double price;
//};
//
//int main()
//{
//	using namespace std;
//	inflateable guest =
//	{
//		"Glorious Gloria",
//	    1.88,
//		29.99
//	};
//	inflateable pal =
//	{
//		"Audacious Arthur",
//		3.12,
//		32.99
//	};
//	cout << "Expand your guest list with " << guest.name << " and " << pal.name << "!\n";
//	cout << "You can have both for $" << guest.price + pal.price << "!\n";
//
//	return 0;
//}



//assgn_st.cpp
//struct inflateable
//{
//	char name[20];
//	float volumn;
//	double price;
//};
//
//int main()
//{
//	using namespace std;
//	inflateable bouquet =
//	{
//		"sunflowers",
//		0.20,
//		12.49
//	};
//	inflateable choice;
//	cout << "bouquer: " << bouquet.name << " for $" << bouquet.price << endl;
//	choice = bouquet;
//	cout << "choice: " << choice.name << " for $" << choice.price << endl;
//
//	return 0;
//}



//arrsturc.cpp
//struct inflateable
//{
//	char name[20];
//	float volumn;
//	double price;
//};
//
//int main()
//{
//	using namespace std;
//	inflateable guests[2] =
//	{
//		{"Bambi", 0.5, 21.99},
//		{"Godzilla", 2000, 565.99}
//	};
//
//	cout << "The guest " << guests[0].name << " and " << guests[1].name
//		<< "\nhave a combined volums of "
//		<< guests[0].volumn + guests[1].volumn << " cubic feet.\n";
//
//	return 0;
//}



//address.cpp
//int main()
//{
//	using namespace std;
//	int donuts = 6;
//	double cups = 4.5;
//
//	cout << "Donuts value = " << donuts;
//	cout << " and donuts address = " << &donuts << endl;
//	cout << "Cups value = " << cups;
//	cout << " and cups address = " << &cups << endl;
//
//	return 0;
//}



//pointer.cpp
//int main()
//{
//	using namespace std;
//	int updates = 6;
//	int* p_updates;
//	p_updates = &updates;
//
//	cout << "Values: updates = " << updates << ", *p_updates = " << *p_updates << endl;
//	cout << "Adress: &updates = " << &updates << ", p_updates = " << p_updates << endl;
//	*p_updates += 1;
//	cout << "Now updates = " << updates << endl;
//
//	return 0;
//}



//init_ptr.cpp
//int main()
//{
//	using namespace std;
//	int higgens = 5;
//	int* pt = &higgens;
//
//	cout << "Value of higgens = " << higgens << "; address of higgens = " << &higgens << endl;
//	cout << "Value of *pt = " << *pt;
//	cout << "; address of pt = " << pt << endl;
//
//	return 0;
//}



//use_new.cpp
//int main()
//{
//	using namespace std;
//	int nights = 1001;
//	int * pt = new int;
//	*pt = 1001;
//
//	cout << "nights value = ";
//	cout << nights << ": location " << &nights << endl;
//	cout << "int ";
//	cout << "value = " << *pt << ": location = " << pt << endl;
//	double * pd = new double;
//	*pd = 10000001.0;
//
//	cout << "doule ";
//	cout << "value = " << *pd << ": location = " << pd << endl;
//	cout << "location of pointer pd: " << &pd << endl;
//	cout << "size of pt = " << sizeof(pt);
//	cout << "; size of *pt = " << sizeof(*pt) << endl;
//	cout << "size of pd = " << sizeof(pd);
//	cout << "; size of *pd = " << sizeof(*pd) << endl;
//
//	return 0;
//}



//arraynew.cpp
//int main()
//{
//	using namespace std;
//	double* p3 = new double[3];
//	p3[0] = 0.2;
//	p3[1] = 0.5;
//	p3[2] = 0.8;
//	cout << "p3[1] is " << p3[1] << ".\n";
//	p3 += 1;
//	cout << "Now p3[0] is " << p3[0] << " and ";
//	cout << "p3[1] is " << p3[1] << ".\n";
//	p3 -= 1;
//	delete[] p3;
// 
//	return 0;
//}



//addpntr.cpp
//int main()
//{
//	using namespace std;
//	double wages[3] = { 10000.0 , 20000.0 , 30000.0 };
//	short stacks[3] = { 3,2,1 };
//
//	double* pw = wages;
//	short* ps = &stacks[0];
//	cout << "pw = " << pw << ", *pw = " << *pw << endl;
//	pw += 1;
//	cout << "Add 1 to the pw pointer:\n";
//	cout << "pw = " << pw << ", *pw = " << *pw << "\n\n";
//	cout << "ps = " << ps << ", *ps = " << *ps << endl;
//	ps += 1;
//	cout << "Add 1 to the ps pointer:\n";
//	cout << "ps = " << ps << ", *ps = " << *ps << "\n\n";
//
//	cout << "Access two elements with arrary notation\n";
//	cout << "stacks[0] = " << stacks[0];
//	cout << ", stacks[1] = " << stacks[1] << endl;
//	cout << "Access two elements with pointer notation\n";
//	cout << "*stacks = " << *stacks;
//	cout << ", *(stacks + 1) = " << *(stacks + 1) << endl;
//
//	cout << sizeof(wages) << " = size of wages arrary\n";
//	cout << sizeof(pw) << " = size of pw pointer\n";
//
//	return 0;
//}



//#include<cstring>
//int main()
//{
//	using namespace std;
//	char animal[20] = "bear";
//	const char * bird = "wren";
//	char* ps;
//
//	cout << animal << " and " << bird << endl;
//
//	cout << "Enter a kind of animal: ";
//	cin >> animal;
//
//	ps = animal;
//	cout << ps << "!\n";
//	cout << "Before using strcpy()\n";
//	cout << animal << " at " << (int*)animal << endl;
//	cout << ps << " at " << (int*)ps << endl;
//
//	ps = new char[strlen(animal)];
//	strcpy(ps, animal);
//	cout << "After using strcpy()\n";
//	cout << animal << " at " << (int*)animal << endl;
//	cout << ps << " at " << (int*)ps << endl;
//	delete[] ps;
//
//	return 0;
//}



//newstrct.cpp
//struct inflateable
//{
//	char name[20];
//	float volume;
//	double price;
//};
//
//int main()
//{
//	using namespace std;
//	inflateable* ps = new inflateable;
//	cout << "Enter name of inflateable item: ";
//	cin.get(ps->name,20);
//	cout << "Enter volume in cubic feet: ";
//	cin >> (*ps).volume;
//	cout << "Enter price: $";
//	cin >> ps->price;
//	cout << "Name: " << (*ps).name << endl;
//	cout << "Vlume:  " << ps->volume << " cubic feet\n";
//	cout << "Price: $" << ps->price << endl;
//	delete ps;
//
//	return 0;
//}



//#include<cstring>
//
//char* getname(void);
//
//int main()
//{
//	using namespace std;
//	char* name;
//	name = getname();
//	cout << "Name: " << name << " at " << (int*)name << endl;
//	delete[] name;
//	name = getname();
//	cout << "Name: " << name << " at " << (int*)name << endl;
//	delete[] name;
//
//	return 0;
//}
//
//char* getname()
//{
//	using namespace std;
//	char temp[80];
//	cout << "Enter last name: ";
//	cin >> temp;
//	char* pn = new char[strlen(temp) + 1];
//	strcpy(pn, temp);
//
//	return pn;
//}



//mixtypes.cpp
//struct antarctica_end_year
//{
//	int year;
//};
//
//int main()
//{
//	using namespace std;
//	antarctica_end_year s01, s02, s03;
//	s01.year = 1998;
//	antarctica_end_year* pa = &s02;
//	pa->year = 1999;
//	antarctica_end_year trio[3];
//	trio[0].year = 2003;
//	cout << trio->year << endl;
//	antarctica_end_year* arp[3] = { &s01,&s02,&s03 };
//	cout << arp[1]->year << endl;
//	antarctica_end_year** ppa = arp;
//	auto ppb = arp;
//	cout << (*ppa)->year << endl;
//	cout << (*(ppb + 1))->year << endl;
//
//	return 0;
//}



//#include<vector>
//#include<array>
//int main()
//{
//	using namespace std;
//	double a1[4] = { 1.2, 2.4, 3.6, 4.8 };
//	vector<double> a2(4);
//	a2[0] = 1.0 / 3.0;
//	a2[1] = 1.0 / 5.0;
//	a2[2] = 1.0 / 7.0;
//	a2[3] = 1.0 / 9.0;
//	array<double, 4>a3 = { 3.14,2.72,1.62,1.41 };
//	array<double, 4>a4;
//	a4 = a3;
//	cout << "a1[2]: " << a1[2] << " at " << &a1[2] << endl;
//	cout << "a2[2]: " << a2[2] << " at " << &a2[2] << endl;
//	cout << "a3[2]: " << a3[2] << " at " << &a3[2] << endl;
//	cout << "a4[2]: " << a4[2] << " at " << &a4[2] << endl;
//	a1[-2] = 20.2;
//	cout << "a1[-2]: " << a1[-2] << " at " << &a1[-2] << endl;
//	cout << "a3[2]: " << a3[2] << " at " << &a3[2] << endl;
//	cout << "a4[2]: " << a4[2] << " at " << &a4[2] << endl;
//
//	return 0;
//}
